#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    // 启动一下线程
    thread.start();
    // 关联槽函数，接受信号
    connect(&thread, &Thread::notify, this, &Widget::handle);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handle()
{
    int value = ui->lcdNumber->value();
    if(value == 0) return;
    ui->lcdNumber->display(value-1);
}

